/*
 * @(#)QueryTimeListener.java, 2024/2/22 11:02
 *
 * Copyright (c) 2018-2024, 四川蜀天梦图数据科技有限公司.
 * All rights reserved.
 */
package controllers;

import org.apache.lucene.search.Query;

/**
 * QueryTimeListener
 *
 * @author fantazy
 * @version 1.0, 2024年02月22日
 */
public class QueryTimeListener implements SearchContext.SearchListener
{
    private long nowTimeMills;
    private long totalTimeUsed;

    @Override
    public void beforeSearch()
    {
        nowTimeMills = System.currentTimeMillis();
    }

    @Override
    public void afterSearch()
    {
        totalTimeUsed = System.currentTimeMillis() - nowTimeMills;
    }

    public long getQueryTimeUsed()
    {
        return totalTimeUsed;
    }
}
